Function Reference

_GUICtrlEditLineLength

Retrieves the length, in characters, of a line in an edit control.

#Include <GuiEdit.au3>
_GUICtrlEditLineLength($h_edit[, $i_index = -1])

 

Parameters

$h_edit control id/control hWnd
$i_index Optional: Specifies the character index of a character in the line whose length is to be retrieved.

 

Return Value

For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the $i_index parameter.
For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control.

 

Remarks

$i_index
    For ANSI text, this is the number of bytes
    For Unicode text, this is the number of characters.
    It does not include the carriage-return character at the end of the line.
    If $i_index is greater than the number of characters in the control, the return value is zero.

 

Related

_GUICtrlEditGetLineCount

 

Example


#include <GUIConstants.au3>
#include <GuiEdit.au3>

opt('MustDeclareVars', 1)

Dim $myedit, $Status, $msg, $Btn_GET

GUICreate("Edit Line Length", 392, 254)

$myedit = GUICtrlCreateEdit("First line" & @CRLF, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetLimit($myedit, 1500)
$Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
$Btn_GET = GUICtrlCreateButton("Get", 150, 130, 90, 40, $BS_MULTILINE)

; will be append dont' forget 3rd parameter
GUICtrlSetData($myedit, "2nd line" & @CRLF & "3rd line" & @CRLF & "4th line" & @CRLF & _
      "5th line" & @CRLF & "6th line" & @CRLF & "7th line" & @CRLF & "8th line" & @CRLF & "9th line", 1)

GUISetState()

; Run the GUI until the dialog is closed
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $Btn_GET
         GUICtrlSetData($Status, "Line Length: " & _GUICtrlEditLineLength ($myedit))
   EndSelect
WEnd